﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace PDX.ChangeTracking
{
    /// <summary>
    /// Captures a snapshot of an Editor's state
    /// </summary>
    public class Snapshot
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Snapshot"/> class.
        /// </summary>
        /// <param name="propertyModel">The property model.</param>
        /// <param name="editor">The editor.</param>
        /// <param name="value">The value.</param>
        /// <param name="focusedElement">The focused element.</param>
        public static Snapshot Create(IPropertyModel propertyModel, Editor editor, object value, IInputElement focusedElement)
        {
            var snapshot = new Snapshot();
            snapshot.PropertyModel = propertyModel;
            snapshot.Editor = editor;
            snapshot.Value = value;
            snapshot.FocusedElement = focusedElement;
            return snapshot;
        }

        /// <summary>
        /// Gets or sets the property model.
        /// </summary>
        /// <value>
        /// The property model.
        /// </value>
        public IPropertyModel PropertyModel { get; set; }

        /// <summary>
        /// Gets or sets the editor.
        /// </summary>
        /// <value>
        /// The editor.
        /// </value>
        public Editor Editor { get; set; }

        /// <summary>
        /// Gets or sets the value.
        /// </summary>
        /// <value>
        /// The value.
        /// </value>
        public object Value { get; set; }

        /// <summary>
        /// Gets or sets the element that was focused when the change was made.
        /// </summary>
        /// <value>
        /// The focused element.
        /// </value>
        public IInputElement FocusedElement { get; set; }
    }
}
